package cn.sumpu.app.guoguojie.web.mvc.rebate;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.sumpu.app.guoguojie.biz.CmsContentBiz;
import cn.sumpu.app.guoguojie.biz.DoingBiz;
import cn.sumpu.app.guoguojie.domain.CmsContent;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;
import cn.sumpu.app.guoguojie.util.PageModel;
/**
 * @author sumpu
 * @version $Id: MobileController.java, v 0.1 2012-9-10 上午16:59:46 sumpu Exp $
 */
@Controller
public class RebateController {
    private final static Logger logger = LoggerFactory.getLogger(RebateController.class);
    
    @Autowired
    private DoingBiz doingBiz;
    
    @Autowired
    private CmsContentBiz cmsContentBiz;
    
    @RequestMapping(value = "/rebate/rebate.htm")
    public String rebate(Integer page,HttpServletRequest request) {
        try {
            PageModel pageModel = doingBiz.getFanliProduct(page);
            request.setAttribute("pageModel", pageModel);
            //右侧栏富文本
            List<CmsContent> rightContent = cmsContentBiz.getContentList("c2437653-ff10-4e67-b697-de70f4160a19", 1);
            request.setAttribute("rightContent", rightContent);
//            右侧通用广告
            List<CmsContent> rightAdv = cmsContentBiz.getContentList("b4c0eb3e-3a16-46bc-9a75-91c5bfe7734d", 1);
            request.setAttribute("rightAdv", rightAdv);
//          一周财富榜                                                                                                                                 3b7c56ee-cb4c-4726-96f1-c74813feb545
            List<CmsContent> rankList = cmsContentBiz.getContentList("3b7c56ee-cb4c-4726-96f1-c74813feb545", 6); 
            request.setAttribute("rankList", rankList);
            
            
//            顶部通栏广告
            List<CmsContent> topAdv = cmsContentBiz.getContentList("91b3532d-4d56-4435-ae4b-d25809fb95fd", 1);
            request.setAttribute("topAdv", topAdv);
            
            List<CmsContent> lunboList =cmsContentBiz.getContentList("315ed68d-c4da-4a91-b693-458450f5ee80", 4);
            request.setAttribute("lunboList", lunboList);
            
            //推送的标签100000082
            List<CmsContent> tagList =cmsContentBiz.getContentList("91f6518f-72b1-416e-8cb9-60d735315a49", 12);
            request.setAttribute("tagList", tagList);
        } catch (AppBusinessException e) {
            logger.error("[/member/registerop.htm] fail", e);
            e.printStackTrace();
        }
        return "v3/rebate/rebate";
    }
}
